#include <bits/stdc++.h>
using namespace std;

typedef long long LL;

const int N = 2e5+5;

int a[N], n;

int main(int argc, char const *argv[])
{
	int t;
	// cin >> t;
	scanf("%d", &t);
	for (int kk=0; kk<t; ++kk)
	{
		scanf("%d", &n);
		LL x = 0, y = 0;
		for (int i=0; i<n; ++i) {
			scanf("%d", &a[i]);
			x ^= a[i];
			y += a[i];
		}
		printf("2\n%lld %lld\n", x, (y + x));

	}
	return 0;
}